package com.controller;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.entity.Student;
import com.github.pagehelper.PageInfo;
import com.service.StudentService;
 
@RestController
@RequestMapping("/testBoot")
public class StudentController {
 
    @Autowired
    private StudentService studentService;
    
    @RequestMapping("/getAllStudents")              //    http://localhost:8088/testBoot/getAllStudents?pageNum=1&pageSize=3
    public PageInfo<Student> getAllStudents(int pageNum,int pageSize){
        return studentService.getAllStudents(pageNum, pageSize);
    }
    
//    接口参数   http://localhost:8080/testBoot/saveStudents
    
    
    @PostMapping("/saveStudents")                  
    public String saveStudents(@RequestBody Student student){
        System.err.println(student);
        return studentService.saveStudents(student);
    }
    
}